﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlBaoCaoCayPhanCap.ascx.cs" Inherits="WebUserControl_ControlBaoCaoCayPhanCap" %>
<%@ Register assembly="DevExpress.Web.ASPxTreeList.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxTreeList" tagprefix="dxwtl" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>


<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.2" namespace="DevExpress.Web.ASPxEditors" tagprefix="dxe" %>
<%@ Register assembly="DevExpress.Web.ASPxTreeList.v9.2.Export" namespace="DevExpress.Web.ASPxTreeList.Export" tagprefix="dxwtl" %>
<%@ Register src="uscMsgBox.ascx" tagname="uscMsgBox" tagprefix="uc2" %>

<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/datePicker.css")%>' type="text/css" />
<link rel="stylesheet" href='<%=ResolveUrl("~/LayoutCss/K_BaoCaoFormLayout.css")%>' type="text/css" />

<script type="text/javascript">
function pageLoad() {
     
     $(function()
        {
	            $("#<%= txtFromDate.ClientID %>").datePicker(
	                {
	                    clickInput:true,
			            startDate: '01/01/1970'
	                }
	                );
        });
	            
	            $("#<%= txtFromDate.ClientID %>").bind(
		            'dpClosed',function(e, selectedDates)
		                        {
			                        var d = selectedDates[0];
			                        if (d) {
				                            d = new Date(d);
				                            $("#<%= txtToDate.ClientID %>").dpSetStartDate(d.addDays(0).asString());
			                                }
		                        }
	                    );
	                    
	     $(function()
        {
	            $("#<%= txtToDate.ClientID %>").datePicker(
	                {
	                    clickInput:true
			           
	                }
	                );
        });
	
	          $("#<%= txtToDate.ClientID %>").bind(
		           'dpClosed',function(e, selectedDates)
		                        {
			                        var d = selectedDates[0];
			                        if (d) {
				                            d = new Date(d);
				                            $("#<%= txtFromDate.ClientID %>").dpSetEndDate(d.addDays(0).asString());
			                                }
		                        }
	            );


     
       $("#<%= Button1.ClientID %>").click(function() {
       if ($("#<%= txtFromDate.ClientID %>").val().length>0 && $("#<%= txtToDate.ClientID %>").val().length>0 && $("#<%= txtTuVanVien.ClientID %>").val().length>0)
        {
        $.blockUI({
             message: '<h1>Xin vui lòng chờ xử lý</h1>', 
            css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#f00', 
            opacity: .5, 
            color: '#fff' 
        } });
        } 
        }); 
        $("#<%= Button2.ClientID %>").click(function() { 
        $.blockUI({
             message: '<h1>Xin vui lòng chờ xử lý</h1>', 
            css: { 
            border: 'none', 
            padding: '15px', 
            backgroundColor: '#f00', 
            opacity: .5, 
            color: '#fff'
        } }); 
         setTimeout($.unblockUI, 5000); 
        }); 
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
                function EndRequestHandler(sender, args) {
                        $.unblockUI();
                }
        }  
</script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <fieldset>
    <legend>Sơ đồ tuyến</legend>
    <div class="fm-req">
      <label for="txtFromDate">Từ ngày:</label>
      <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ErrorMessage="Phải chọn thời gian" ControlToValidate="txtFromDate" Display="None"></asp:RequiredFieldValidator>
                    <cc1:ValidatorCalloutExtender ID="RequiredFieldValidator1_ValidatorCalloutExtender" 
                        runat="server" TargetControlID="RequiredFieldValidator1">
                    </cc1:ValidatorCalloutExtender>
                    <asp:TextBox ID="txtFromDate" runat="server"></asp:TextBox>
    </div>
    <div class="fm-req">
      <label for="txtToDate">Đến ngày:</label>
      <asp:RequiredFieldValidator ControlToValidate="txtToDate" ID="RequiredFieldValidator2" runat="server" 
                        ErrorMessage="Phải chọn thời gian" Display="None"></asp:RequiredFieldValidator>
                    <cc1:ValidatorCalloutExtender ID="RequiredFieldValidator2_ValidatorCalloutExtender" 
                        runat="server" TargetControlID="RequiredFieldValidator2">
                    </cc1:ValidatorCalloutExtender>
                    <asp:TextBox ID="txtToDate"  runat="server"></asp:TextBox>
                    
    </div>
    <div class="fm-req">
      <label for="txtTuVanVien">Chọn TVV:</label>
       <asp:TextBox ID="txtTuVanVien" runat="server"></asp:TextBox>
                     <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                        ErrorMessage="Nhập mã tư vấn viên" Display="None" ControlToValidate="txtTuVanVien">
                        </asp:RequiredFieldValidator>
                    <AjaxControls:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator3" ID="ValidatorCalloutExtender1" runat="server">
                    </AjaxControls:ValidatorCalloutExtender> 
                    
    </div>
    
    <div class="fm-multi">
      <div class="fm-opt">
        <asp:CheckBox ID="CheckBox1" Text="Chỉ xem TVV có doanh số" runat="server" />
      </div>
    </div>
    
    
    </fieldset>
    <div>
             <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Xem" 
                        style="height: 20px" />&nbsp;&nbsp;
                    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" CausesValidation="false" 
                        Text="Xuất ra excel" />
     </div>
     <br />
        <dxwtl:ASPxTreeList ID="ASPxTreeList1" runat="server" 
            AutoGenerateColumns="False" KeyFieldName="salesp_key" 
            ParentFieldName="Recommender" 
            onhtmlrowprepared="ASPxTreeList1_HtmlRowPrepared" 
            onnodeupdating="ASPxTreeList1_NodeUpdating">
            
           <Styles>
               <GroupFooter BackColor="Yellow" Font-Bold="True" ForeColor="Blue">
               </GroupFooter>
               <Footer BackColor="Aqua" Font-Bold="true" ForeColor="Yellow">
               </Footer>
           </Styles>
          
            <Settings ShowFooter="True" ShowGroupFooter="True" />
          
            <SettingsEditing Mode="EditFormAndDisplayNode" />
            <Columns>
                <dxwtl:TreeListTextColumn Caption="Tên tư vấn viên" FieldName="TVV" 
                    VisibleIndex="0">
                    <EditFormSettings VisibleIndex="1" Visible="False" />
                </dxwtl:TreeListTextColumn>
                <dxwtl:TreeListTextColumn Caption="Doanh số" FieldName="DoanhSo" 
                    VisibleIndex="1">
                      <PropertiesTextEdit DisplayFormatString="{0:#,###}">
                      </PropertiesTextEdit>
                      <EditFormSettings VisibleIndex="2" Visible="False" />
                </dxwtl:TreeListTextColumn>
                <dxwtl:TreeListTextColumn Caption="Điện thoại di động" FieldName="Mobile" 
                    VisibleIndex="2">
                      <EditFormSettings VisibleIndex="3" Visible="False" />
                </dxwtl:TreeListTextColumn>
               
                <dxwtl:TreeListTextColumn Caption="Địa chỉ" FieldName="DiaChi" VisibleIndex="3">
                  <EditFormSettings VisibleIndex="4" Visible="False" />
                </dxwtl:TreeListTextColumn>
             <dxwtl:TreeListTextColumn FieldName="ChucVu" VisibleIndex="4" Visible="false">
             
                </dxwtl:TreeListTextColumn>
             <dxwtl:TreeListTextColumn Caption="Mã người giới thiệu" FieldName="Recommender" Visible="false" VisibleIndex="5">
             <EditFormSettings VisibleIndex="0" Visible="True" />
                </dxwtl:TreeListTextColumn>
                <dxwtl:TreeListCommandColumn ButtonType="Image" VisibleIndex="4" Caption="Sửa">
                    <EditButton Visible="True">
                        <Image AlternateText="Sửa" Height="20px" Url="~/image/Edit file.png" 
                            Width="20px" />
                    </EditButton>
                    <UpdateButton Visible="True">
                        <Image AlternateText="Cập nhật" Height="20px" Url="~/image/Save.png" 
                            Width="20px" />
                    </UpdateButton>
                    <CancelButton Visible="True">
                        <Image AlternateText="Thoát" Height="20px" Url="~/image/Undo.png" 
                            Width="20px" />
                    </CancelButton>
                   
                </dxwtl:TreeListCommandColumn>
            
            </Columns>
            
        </dxwtl:ASPxTreeList>
        <br />
       
        <dxwtl:ASPxTreeListExporter TreeListID="ASPxTreeList1" ID="ASPxTreeListExporter1" runat="server">
        </dxwtl:ASPxTreeListExporter>
        <br />
    </ContentTemplate>
    

    <Triggers> <asp:PostBackTrigger  ControlID="Button2"/></Triggers>
  
</asp:UpdatePanel>
 

 <uc2:uscMsgBox ID="uscMsgBox1" runat="server" />



